<?php


/**
 * Base class that represents a query for the 'application_data_sets' table.
 *
 *
 *
 * @method ApplicationDataSetsQuery orderById($order = Criteria::ASC) Order by the id column
 * @method ApplicationDataSetsQuery orderByApplicationId($order = Criteria::ASC) Order by the application_id column
 * @method ApplicationDataSetsQuery orderByName($order = Criteria::ASC) Order by the name column
 * @method ApplicationDataSetsQuery orderByNameEn($order = Criteria::ASC) Order by the name_en column
 * @method ApplicationDataSetsQuery orderByDescription($order = Criteria::ASC) Order by the description column
 * @method ApplicationDataSetsQuery orderByDescriptionEn($order = Criteria::ASC) Order by the description_en column
 * @method ApplicationDataSetsQuery orderByIco($order = Criteria::ASC) Order by the ico column
 * @method ApplicationDataSetsQuery orderByIcoType($order = Criteria::ASC) Order by the ico_type column
 * @method ApplicationDataSetsQuery orderByUrl($order = Criteria::ASC) Order by the url column
 * @method ApplicationDataSetsQuery orderByStatus($order = Criteria::ASC) Order by the status column
 * @method ApplicationDataSetsQuery orderByLastModified($order = Criteria::ASC) Order by the last_modified column
 * @method ApplicationDataSetsQuery orderByCreated($order = Criteria::ASC) Order by the created column
 *
 * @method ApplicationDataSetsQuery groupById() Group by the id column
 * @method ApplicationDataSetsQuery groupByApplicationId() Group by the application_id column
 * @method ApplicationDataSetsQuery groupByName() Group by the name column
 * @method ApplicationDataSetsQuery groupByNameEn() Group by the name_en column
 * @method ApplicationDataSetsQuery groupByDescription() Group by the description column
 * @method ApplicationDataSetsQuery groupByDescriptionEn() Group by the description_en column
 * @method ApplicationDataSetsQuery groupByIco() Group by the ico column
 * @method ApplicationDataSetsQuery groupByIcoType() Group by the ico_type column
 * @method ApplicationDataSetsQuery groupByUrl() Group by the url column
 * @method ApplicationDataSetsQuery groupByStatus() Group by the status column
 * @method ApplicationDataSetsQuery groupByLastModified() Group by the last_modified column
 * @method ApplicationDataSetsQuery groupByCreated() Group by the created column
 *
 * @method ApplicationDataSetsQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
 * @method ApplicationDataSetsQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
 * @method ApplicationDataSetsQuery innerJoin($relation) Adds a INNER JOIN clause to the query
 *
 * @method ApplicationDataSetsQuery leftJoinApplications($relationAlias = null) Adds a LEFT JOIN clause to the query using the Applications relation
 * @method ApplicationDataSetsQuery rightJoinApplications($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Applications relation
 * @method ApplicationDataSetsQuery innerJoinApplications($relationAlias = null) Adds a INNER JOIN clause to the query using the Applications relation
 *
 * @method ApplicationDataSetsQuery leftJoinApplicationDataDefs($relationAlias = null) Adds a LEFT JOIN clause to the query using the ApplicationDataDefs relation
 * @method ApplicationDataSetsQuery rightJoinApplicationDataDefs($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ApplicationDataDefs relation
 * @method ApplicationDataSetsQuery innerJoinApplicationDataDefs($relationAlias = null) Adds a INNER JOIN clause to the query using the ApplicationDataDefs relation
 *
 * @method ApplicationDataSets findOne(PropelPDO $con = null) Return the first ApplicationDataSets matching the query
 * @method ApplicationDataSets findOneOrCreate(PropelPDO $con = null) Return the first ApplicationDataSets matching the query, or a new ApplicationDataSets object populated from the query conditions when no match is found
 *
 * @method ApplicationDataSets findOneById(int $id) Return the first ApplicationDataSets filtered by the id column
 * @method ApplicationDataSets findOneByApplicationId(int $application_id) Return the first ApplicationDataSets filtered by the application_id column
 * @method ApplicationDataSets findOneByName(string $name) Return the first ApplicationDataSets filtered by the name column
 * @method ApplicationDataSets findOneByNameEn(string $name_en) Return the first ApplicationDataSets filtered by the name_en column
 * @method ApplicationDataSets findOneByDescription(string $description) Return the first ApplicationDataSets filtered by the description column
 * @method ApplicationDataSets findOneByDescriptionEn(string $description_en) Return the first ApplicationDataSets filtered by the description_en column
 * @method ApplicationDataSets findOneByIco(string $ico) Return the first ApplicationDataSets filtered by the ico column
 * @method ApplicationDataSets findOneByIcoType(int $ico_type) Return the first ApplicationDataSets filtered by the ico_type column
 * @method ApplicationDataSets findOneByUrl(string $url) Return the first ApplicationDataSets filtered by the url column
 * @method ApplicationDataSets findOneByStatus(int $status) Return the first ApplicationDataSets filtered by the status column
 * @method ApplicationDataSets findOneByLastModified(string $last_modified) Return the first ApplicationDataSets filtered by the last_modified column
 * @method ApplicationDataSets findOneByCreated(string $created) Return the first ApplicationDataSets filtered by the created column
 *
 * @method array findById(int $id) Return ApplicationDataSets objects filtered by the id column
 * @method array findByApplicationId(int $application_id) Return ApplicationDataSets objects filtered by the application_id column
 * @method array findByName(string $name) Return ApplicationDataSets objects filtered by the name column
 * @method array findByNameEn(string $name_en) Return ApplicationDataSets objects filtered by the name_en column
 * @method array findByDescription(string $description) Return ApplicationDataSets objects filtered by the description column
 * @method array findByDescriptionEn(string $description_en) Return ApplicationDataSets objects filtered by the description_en column
 * @method array findByIco(string $ico) Return ApplicationDataSets objects filtered by the ico column
 * @method array findByIcoType(int $ico_type) Return ApplicationDataSets objects filtered by the ico_type column
 * @method array findByUrl(string $url) Return ApplicationDataSets objects filtered by the url column
 * @method array findByStatus(int $status) Return ApplicationDataSets objects filtered by the status column
 * @method array findByLastModified(string $last_modified) Return ApplicationDataSets objects filtered by the last_modified column
 * @method array findByCreated(string $created) Return ApplicationDataSets objects filtered by the created column
 *
 * @package    propel.generator..om
 */
abstract class BaseApplicationDataSetsQuery extends ModelCriteria
{
    /**
     * Initializes internal state of BaseApplicationDataSetsQuery object.
     *
     * @param     string $dbName The dabase name
     * @param     string $modelName The phpName of a model, e.g. 'Book'
     * @param     string $modelAlias The alias for the model in this query, e.g. 'b'
     */
    public function __construct($dbName = 'vgp_hr_app', $modelName = 'ApplicationDataSets', $modelAlias = null)
    {
        parent::__construct($dbName, $modelName, $modelAlias);
    }

    /**
     * Returns a new ApplicationDataSetsQuery object.
     *
     * @param     string $modelAlias The alias of a model in the query
     * @param     ApplicationDataSetsQuery|Criteria $criteria Optional Criteria to build the query from
     *
     * @return ApplicationDataSetsQuery
     */
    public static function create($modelAlias = null, $criteria = null)
    {
        if ($criteria instanceof ApplicationDataSetsQuery) {
            return $criteria;
        }
        $query = new ApplicationDataSetsQuery();
        if (null !== $modelAlias) {
            $query->setModelAlias($modelAlias);
        }
        if ($criteria instanceof Criteria) {
            $query->mergeWith($criteria);
        }

        return $query;
    }

    /**
     * Find object by primary key.
     * Propel uses the instance pool to skip the database if the object exists.
     * Go fast if the query is untouched.
     *
     * <code>
     * $obj  = $c->findPk(12, $con);
     * </code>
     *
     * @param mixed $key Primary key to use for the query
     * @param     PropelPDO $con an optional connection object
     *
     * @return   ApplicationDataSets|ApplicationDataSets[]|mixed the result, formatted by the current formatter
     */
    public function findPk($key, $con = null)
    {
        if ($key === null) {
            return null;
        }
        if ((null !== ($obj = ApplicationDataSetsPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
            // the object is alredy in the instance pool
            return $obj;
        }
        if ($con === null) {
            $con = Propel::getConnection(ApplicationDataSetsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
        }
        $this->basePreSelect($con);
        if ($this->formatter || $this->modelAlias || $this->with || $this->select
         || $this->selectColumns || $this->asColumns || $this->selectModifiers
         || $this->map || $this->having || $this->joins) {
            return $this->findPkComplex($key, $con);
        } else {
            return $this->findPkSimple($key, $con);
        }
    }

    /**
     * Find object by primary key using raw SQL to go fast.
     * Bypass doSelect() and the object formatter by using generated code.
     *
     * @param     mixed $key Primary key to use for the query
     * @param     PropelPDO $con A connection object
     *
     * @return   ApplicationDataSets A model object, or null if the key is not found
     * @throws   PropelException
     */
    protected function findPkSimple($key, $con)
    {
        $sql = 'SELECT ID, APPLICATION_ID, NAME, NAME_EN, DESCRIPTION, DESCRIPTION_EN, ICO, ICO_TYPE, URL, STATUS, LAST_MODIFIED, CREATED FROM application_data_sets WHERE ID = :p0';
        try {
            $stmt = $con->prepare($sql);
            $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
            $stmt->execute();
        } catch (Exception $e) {
            Propel::log($e->getMessage(), Propel::LOG_ERR);
            throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
        }
        $obj = null;
        if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
            $obj = new ApplicationDataSets();
            $obj->hydrate($row);
            ApplicationDataSetsPeer::addInstanceToPool($obj, (string) $key);
        }
        $stmt->closeCursor();

        return $obj;
    }

    /**
     * Find object by primary key.
     *
     * @param     mixed $key Primary key to use for the query
     * @param     PropelPDO $con A connection object
     *
     * @return ApplicationDataSets|ApplicationDataSets[]|mixed the result, formatted by the current formatter
     */
    protected function findPkComplex($key, $con)
    {
        // As the query uses a PK condition, no limit(1) is necessary.
        $criteria = $this->isKeepQuery() ? clone $this : $this;
        $stmt = $criteria
            ->filterByPrimaryKey($key)
            ->doSelect($con);

        return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
    }

    /**
     * Find objects by primary key
     * <code>
     * $objs = $c->findPks(array(12, 56, 832), $con);
     * </code>
     * @param     array $keys Primary keys to use for the query
     * @param     PropelPDO $con an optional connection object
     *
     * @return PropelObjectCollection|ApplicationDataSets[]|mixed the list of results, formatted by the current formatter
     */
    public function findPks($keys, $con = null)
    {
        if ($con === null) {
            $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
        }
        $this->basePreSelect($con);
        $criteria = $this->isKeepQuery() ? clone $this : $this;
        $stmt = $criteria
            ->filterByPrimaryKeys($keys)
            ->doSelect($con);

        return $criteria->getFormatter()->init($criteria)->format($stmt);
    }

    /**
     * Filter the query by primary key
     *
     * @param     mixed $key Primary key to use for the query
     *
     * @return ApplicationDataSetsQuery The current query, for fluid interface
     */
    public function filterByPrimaryKey($key)
    {

        return $this->addUsingAlias(ApplicationDataSetsPeer::ID, $key, Criteria::EQUAL);
    }

    /**
     * Filter the query by a list of primary keys
     *
     * @param     array $keys The list of primary key to use for the query
     *
     * @return ApplicationDataSetsQuery The current query, for fluid interface
     */
    public function filterByPrimaryKeys($keys)
    {

        return $this->addUsingAlias(ApplicationDataSetsPeer::ID, $keys, Criteria::IN);
    }

    /**
     * Filter the query on the id column
     *
     * Example usage:
     * <code>
     * $query->filterById(1234); // WHERE id = 1234
     * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
     * $query->filterById(array('min' => 12)); // WHERE id > 12
     * </code>
     *
     * @param     mixed $id The value to use as filter.
     *              Use scalar values for equality.
     *              Use array values for in_array() equivalent.
     *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return ApplicationDataSetsQuery The current query, for fluid interface
     */
    public function filterById($id = null, $comparison = null)
    {
        if (is_array($id) && null === $comparison) {
            $comparison = Criteria::IN;
        }

        return $this->addUsingAlias(ApplicationDataSetsPeer::ID, $id, $comparison);
    }

    /**
     * Filter the query on the application_id column
     *
     * Example usage:
     * <code>
     * $query->filterByApplicationId(1234); // WHERE application_id = 1234
     * $query->filterByApplicationId(array(12, 34)); // WHERE application_id IN (12, 34)
     * $query->filterByApplicationId(array('min' => 12)); // WHERE application_id > 12
     * </code>
     *
     * @see       filterByApplications()
     *
     * @param     mixed $applicationId The value to use as filter.
     *              Use scalar values for equality.
     *              Use array values for in_array() equivalent.
     *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return ApplicationDataSetsQuery The current query, for fluid interface
     */
    public function filterByApplicationId($applicationId = null, $comparison = null)
    {
        if (is_array($applicationId)) {
            $useMinMax = false;
            if (isset($applicationId['min'])) {
                $this->addUsingAlias(ApplicationDataSetsPeer::APPLICATION_ID, $applicationId['min'], Criteria::GREATER_EQUAL);
                $useMinMax = true;
            }
            if (isset($applicationId['max'])) {
                $this->addUsingAlias(ApplicationDataSetsPeer::APPLICATION_ID, $applicationId['max'], Criteria::LESS_EQUAL);
                $useMinMax = true;
            }
            if ($useMinMax) {
                return $this;
            }
            if (null === $comparison) {
                $comparison = Criteria::IN;
            }
        }

        return $this->addUsingAlias(ApplicationDataSetsPeer::APPLICATION_ID, $applicationId, $comparison);
    }

    /**
     * Filter the query on the name column
     *
     * Example usage:
     * <code>
     * $query->filterByName('fooValue');   // WHERE name = 'fooValue'
     * $query->filterByName('%fooValue%'); // WHERE name LIKE '%fooValue%'
     * </code>
     *
     * @param     string $name The value to use as filter.
     *              Accepts wildcards (* and % trigger a LIKE)
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return ApplicationDataSetsQuery The current query, for fluid interface
     */
    public function filterByName($name = null, $comparison = null)
    {
        if (null === $comparison) {
            if (is_array($name)) {
                $comparison = Criteria::IN;
            } elseif (preg_match('/[\%\*]/', $name)) {
                $name = str_replace('*', '%', $name);
                $comparison = Criteria::LIKE;
            }
        }

        return $this->addUsingAlias(ApplicationDataSetsPeer::NAME, $name, $comparison);
    }

    /**
     * Filter the query on the name_en column
     *
     * Example usage:
     * <code>
     * $query->filterByNameEn('fooValue');   // WHERE name_en = 'fooValue'
     * $query->filterByNameEn('%fooValue%'); // WHERE name_en LIKE '%fooValue%'
     * </code>
     *
     * @param     string $nameEn The value to use as filter.
     *              Accepts wildcards (* and % trigger a LIKE)
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return ApplicationDataSetsQuery The current query, for fluid interface
     */
    public function filterByNameEn($nameEn = null, $comparison = null)
    {
        if (null === $comparison) {
            if (is_array($nameEn)) {
                $comparison = Criteria::IN;
            } elseif (preg_match('/[\%\*]/', $nameEn)) {
                $nameEn = str_replace('*', '%', $nameEn);
                $comparison = Criteria::LIKE;
            }
        }

        return $this->addUsingAlias(ApplicationDataSetsPeer::NAME_EN, $nameEn, $comparison);
    }

    /**
     * Filter the query on the description column
     *
     * Example usage:
     * <code>
     * $query->filterByDescription('fooValue');   // WHERE description = 'fooValue'
     * $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%'
     * </code>
     *
     * @param     string $description The value to use as filter.
     *              Accepts wildcards (* and % trigger a LIKE)
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return ApplicationDataSetsQuery The current query, for fluid interface
     */
    public function filterByDescription($description = null, $comparison = null)
    {
        if (null === $comparison) {
            if (is_array($description)) {
                $comparison = Criteria::IN;
            } elseif (preg_match('/[\%\*]/', $description)) {
                $description = str_replace('*', '%', $description);
                $comparison = Criteria::LIKE;
            }
        }

        return $this->addUsingAlias(ApplicationDataSetsPeer::DESCRIPTION, $description, $comparison);
    }

    /**
     * Filter the query on the description_en column
     *
     * Example usage:
     * <code>
     * $query->filterByDescriptionEn('fooValue');   // WHERE description_en = 'fooValue'
     * $query->filterByDescriptionEn('%fooValue%'); // WHERE description_en LIKE '%fooValue%'
     * </code>
     *
     * @param     string $descriptionEn The value to use as filter.
     *              Accepts wildcards (* and % trigger a LIKE)
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return ApplicationDataSetsQuery The current query, for fluid interface
     */
    public function filterByDescriptionEn($descriptionEn = null, $comparison = null)
    {
        if (null === $comparison) {
            if (is_array($descriptionEn)) {
                $comparison = Criteria::IN;
            } elseif (preg_match('/[\%\*]/', $descriptionEn)) {
                $descriptionEn = str_replace('*', '%', $descriptionEn);
                $comparison = Criteria::LIKE;
            }
        }

        return $this->addUsingAlias(ApplicationDataSetsPeer::DESCRIPTION_EN, $descriptionEn, $comparison);
    }

    /**
     * Filter the query on the ico column
     *
     * Example usage:
     * <code>
     * $query->filterByIco('fooValue');   // WHERE ico = 'fooValue'
     * $query->filterByIco('%fooValue%'); // WHERE ico LIKE '%fooValue%'
     * </code>
     *
     * @param     string $ico The value to use as filter.
     *              Accepts wildcards (* and % trigger a LIKE)
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return ApplicationDataSetsQuery The current query, for fluid interface
     */
    public function filterByIco($ico = null, $comparison = null)
    {
        if (null === $comparison) {
            if (is_array($ico)) {
                $comparison = Criteria::IN;
            } elseif (preg_match('/[\%\*]/', $ico)) {
                $ico = str_replace('*', '%', $ico);
                $comparison = Criteria::LIKE;
            }
        }

        return $this->addUsingAlias(ApplicationDataSetsPeer::ICO, $ico, $comparison);
    }

    /**
     * Filter the query on the ico_type column
     *
     * Example usage:
     * <code>
     * $query->filterByIcoType(1234); // WHERE ico_type = 1234
     * $query->filterByIcoType(array(12, 34)); // WHERE ico_type IN (12, 34)
     * $query->filterByIcoType(array('min' => 12)); // WHERE ico_type > 12
     * </code>
     *
     * @param     mixed $icoType The value to use as filter.
     *              Use scalar values for equality.
     *              Use array values for in_array() equivalent.
     *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return ApplicationDataSetsQuery The current query, for fluid interface
     */
    public function filterByIcoType($icoType = null, $comparison = null)
    {
        if (is_array($icoType)) {
            $useMinMax = false;
            if (isset($icoType['min'])) {
                $this->addUsingAlias(ApplicationDataSetsPeer::ICO_TYPE, $icoType['min'], Criteria::GREATER_EQUAL);
                $useMinMax = true;
            }
            if (isset($icoType['max'])) {
                $this->addUsingAlias(ApplicationDataSetsPeer::ICO_TYPE, $icoType['max'], Criteria::LESS_EQUAL);
                $useMinMax = true;
            }
            if ($useMinMax) {
                return $this;
            }
            if (null === $comparison) {
                $comparison = Criteria::IN;
            }
        }

        return $this->addUsingAlias(ApplicationDataSetsPeer::ICO_TYPE, $icoType, $comparison);
    }

    /**
     * Filter the query on the url column
     *
     * Example usage:
     * <code>
     * $query->filterByUrl('fooValue');   // WHERE url = 'fooValue'
     * $query->filterByUrl('%fooValue%'); // WHERE url LIKE '%fooValue%'
     * </code>
     *
     * @param     string $url The value to use as filter.
     *              Accepts wildcards (* and % trigger a LIKE)
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return ApplicationDataSetsQuery The current query, for fluid interface
     */
    public function filterByUrl($url = null, $comparison = null)
    {
        if (null === $comparison) {
            if (is_array($url)) {
                $comparison = Criteria::IN;
            } elseif (preg_match('/[\%\*]/', $url)) {
                $url = str_replace('*', '%', $url);
                $comparison = Criteria::LIKE;
            }
        }

        return $this->addUsingAlias(ApplicationDataSetsPeer::URL, $url, $comparison);
    }

    /**
     * Filter the query on the status column
     *
     * Example usage:
     * <code>
     * $query->filterByStatus(1234); // WHERE status = 1234
     * $query->filterByStatus(array(12, 34)); // WHERE status IN (12, 34)
     * $query->filterByStatus(array('min' => 12)); // WHERE status > 12
     * </code>
     *
     * @param     mixed $status The value to use as filter.
     *              Use scalar values for equality.
     *              Use array values for in_array() equivalent.
     *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return ApplicationDataSetsQuery The current query, for fluid interface
     */
    public function filterByStatus($status = null, $comparison = null)
    {
        if (is_array($status)) {
            $useMinMax = false;
            if (isset($status['min'])) {
                $this->addUsingAlias(ApplicationDataSetsPeer::STATUS, $status['min'], Criteria::GREATER_EQUAL);
                $useMinMax = true;
            }
            if (isset($status['max'])) {
                $this->addUsingAlias(ApplicationDataSetsPeer::STATUS, $status['max'], Criteria::LESS_EQUAL);
                $useMinMax = true;
            }
            if ($useMinMax) {
                return $this;
            }
            if (null === $comparison) {
                $comparison = Criteria::IN;
            }
        }

        return $this->addUsingAlias(ApplicationDataSetsPeer::STATUS, $status, $comparison);
    }

    /**
     * Filter the query on the last_modified column
     *
     * Example usage:
     * <code>
     * $query->filterByLastModified('2011-03-14'); // WHERE last_modified = '2011-03-14'
     * $query->filterByLastModified('now'); // WHERE last_modified = '2011-03-14'
     * $query->filterByLastModified(array('max' => 'yesterday')); // WHERE last_modified > '2011-03-13'
     * </code>
     *
     * @param     mixed $lastModified The value to use as filter.
     *              Values can be integers (unix timestamps), DateTime objects, or strings.
     *              Empty strings are treated as NULL.
     *              Use scalar values for equality.
     *              Use array values for in_array() equivalent.
     *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return ApplicationDataSetsQuery The current query, for fluid interface
     */
    public function filterByLastModified($lastModified = null, $comparison = null)
    {
        if (is_array($lastModified)) {
            $useMinMax = false;
            if (isset($lastModified['min'])) {
                $this->addUsingAlias(ApplicationDataSetsPeer::LAST_MODIFIED, $lastModified['min'], Criteria::GREATER_EQUAL);
                $useMinMax = true;
            }
            if (isset($lastModified['max'])) {
                $this->addUsingAlias(ApplicationDataSetsPeer::LAST_MODIFIED, $lastModified['max'], Criteria::LESS_EQUAL);
                $useMinMax = true;
            }
            if ($useMinMax) {
                return $this;
            }
            if (null === $comparison) {
                $comparison = Criteria::IN;
            }
        }

        return $this->addUsingAlias(ApplicationDataSetsPeer::LAST_MODIFIED, $lastModified, $comparison);
    }

    /**
     * Filter the query on the created column
     *
     * Example usage:
     * <code>
     * $query->filterByCreated('2011-03-14'); // WHERE created = '2011-03-14'
     * $query->filterByCreated('now'); // WHERE created = '2011-03-14'
     * $query->filterByCreated(array('max' => 'yesterday')); // WHERE created > '2011-03-13'
     * </code>
     *
     * @param     mixed $created The value to use as filter.
     *              Values can be integers (unix timestamps), DateTime objects, or strings.
     *              Empty strings are treated as NULL.
     *              Use scalar values for equality.
     *              Use array values for in_array() equivalent.
     *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return ApplicationDataSetsQuery The current query, for fluid interface
     */
    public function filterByCreated($created = null, $comparison = null)
    {
        if (is_array($created)) {
            $useMinMax = false;
            if (isset($created['min'])) {
                $this->addUsingAlias(ApplicationDataSetsPeer::CREATED, $created['min'], Criteria::GREATER_EQUAL);
                $useMinMax = true;
            }
            if (isset($created['max'])) {
                $this->addUsingAlias(ApplicationDataSetsPeer::CREATED, $created['max'], Criteria::LESS_EQUAL);
                $useMinMax = true;
            }
            if ($useMinMax) {
                return $this;
            }
            if (null === $comparison) {
                $comparison = Criteria::IN;
            }
        }

        return $this->addUsingAlias(ApplicationDataSetsPeer::CREATED, $created, $comparison);
    }

    /**
     * Filter the query by a related Applications object
     *
     * @param   Applications|PropelObjectCollection $applications The related object(s) to use as filter
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return   ApplicationDataSetsQuery The current query, for fluid interface
     * @throws   PropelException - if the provided filter is invalid.
     */
    public function filterByApplications($applications, $comparison = null)
    {
        if ($applications instanceof Applications) {
            return $this
                ->addUsingAlias(ApplicationDataSetsPeer::APPLICATION_ID, $applications->getId(), $comparison);
        } elseif ($applications instanceof PropelObjectCollection) {
            if (null === $comparison) {
                $comparison = Criteria::IN;
            }

            return $this
                ->addUsingAlias(ApplicationDataSetsPeer::APPLICATION_ID, $applications->toKeyValue('PrimaryKey', 'Id'), $comparison);
        } else {
            throw new PropelException('filterByApplications() only accepts arguments of type Applications or PropelCollection');
        }
    }

    /**
     * Adds a JOIN clause to the query using the Applications relation
     *
     * @param     string $relationAlias optional alias for the relation
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return ApplicationDataSetsQuery The current query, for fluid interface
     */
    public function joinApplications($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    {
        $tableMap = $this->getTableMap();
        $relationMap = $tableMap->getRelation('Applications');

        // create a ModelJoin object for this join
        $join = new ModelJoin();
        $join->setJoinType($joinType);
        $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
        if ($previousJoin = $this->getPreviousJoin()) {
            $join->setPreviousJoin($previousJoin);
        }

        // add the ModelJoin to the current object
        if ($relationAlias) {
            $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
            $this->addJoinObject($join, $relationAlias);
        } else {
            $this->addJoinObject($join, 'Applications');
        }

        return $this;
    }

    /**
     * Use the Applications relation Applications object
     *
     * @see       useQuery()
     *
     * @param     string $relationAlias optional alias for the relation,
     *                                   to be used as main alias in the secondary query
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return   ApplicationsQuery A secondary query class using the current class as primary query
     */
    public function useApplicationsQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    {
        return $this
            ->joinApplications($relationAlias, $joinType)
            ->useQuery($relationAlias ? $relationAlias : 'Applications', 'ApplicationsQuery');
    }

    /**
     * Filter the query by a related ApplicationDataDefs object
     *
     * @param   ApplicationDataDefs|PropelObjectCollection $applicationDataDefs  the related object to use as filter
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return   ApplicationDataSetsQuery The current query, for fluid interface
     * @throws   PropelException - if the provided filter is invalid.
     */
    public function filterByApplicationDataDefs($applicationDataDefs, $comparison = null)
    {
        if ($applicationDataDefs instanceof ApplicationDataDefs) {
            return $this
                ->addUsingAlias(ApplicationDataSetsPeer::ID, $applicationDataDefs->getApplicationDataSetId(), $comparison);
        } elseif ($applicationDataDefs instanceof PropelObjectCollection) {
            return $this
                ->useApplicationDataDefsQuery()
                ->filterByPrimaryKeys($applicationDataDefs->getPrimaryKeys())
                ->endUse();
        } else {
            throw new PropelException('filterByApplicationDataDefs() only accepts arguments of type ApplicationDataDefs or PropelCollection');
        }
    }

    /**
     * Adds a JOIN clause to the query using the ApplicationDataDefs relation
     *
     * @param     string $relationAlias optional alias for the relation
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return ApplicationDataSetsQuery The current query, for fluid interface
     */
    public function joinApplicationDataDefs($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    {
        $tableMap = $this->getTableMap();
        $relationMap = $tableMap->getRelation('ApplicationDataDefs');

        // create a ModelJoin object for this join
        $join = new ModelJoin();
        $join->setJoinType($joinType);
        $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
        if ($previousJoin = $this->getPreviousJoin()) {
            $join->setPreviousJoin($previousJoin);
        }

        // add the ModelJoin to the current object
        if ($relationAlias) {
            $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
            $this->addJoinObject($join, $relationAlias);
        } else {
            $this->addJoinObject($join, 'ApplicationDataDefs');
        }

        return $this;
    }

    /**
     * Use the ApplicationDataDefs relation ApplicationDataDefs object
     *
     * @see       useQuery()
     *
     * @param     string $relationAlias optional alias for the relation,
     *                                   to be used as main alias in the secondary query
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return   ApplicationDataDefsQuery A secondary query class using the current class as primary query
     */
    public function useApplicationDataDefsQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    {
        return $this
            ->joinApplicationDataDefs($relationAlias, $joinType)
            ->useQuery($relationAlias ? $relationAlias : 'ApplicationDataDefs', 'ApplicationDataDefsQuery');
    }

    /**
     * Exclude object from result
     *
     * @param   ApplicationDataSets $applicationDataSets Object to remove from the list of results
     *
     * @return ApplicationDataSetsQuery The current query, for fluid interface
     */
    public function prune($applicationDataSets = null)
    {
        if ($applicationDataSets) {
            $this->addUsingAlias(ApplicationDataSetsPeer::ID, $applicationDataSets->getId(), Criteria::NOT_EQUAL);
        }

        return $this;
    }

}
